/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/crypto/CryptProvider.h,v 1.3 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __CRYPTPROVIDER_H__

#include <windows.h>
#include <wincrypt.h>
#include "vectorutils.h"

class CryptProvider {
public:
    CryptProvider();
    ~CryptProvider();

    bool Open();
    bool Close();

    bool GenerateKey(int keyLength);

    bool GetPrivateKey(ByteVector& keydata);
    bool GetPublicKey(ByteVector& keydata);

    bool SetPrivateKey(const ByteVector& keydata);
    bool SetPublicKey(const ByteVector& keydata);

    bool CalculateAndSignHash(const ByteVector& data, ByteVector& signature);
    bool CalculateAndVerifyHash(const ByteVector& data, const ByteVector& signature);


    bool GenerateRandomData(ByteVector& data, int size);

private:
        HCRYPTPROV m_hProv;
        HCRYPTKEY m_hKey;
        HCRYPTHASH m_hHash;
};

#define __CRYPTPROVIDER_H__
#endif
